<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('index')}">潜在客户列表</a></li>
			<if condition="auth_check('import_list')">
				<li class="active"><a href="{:url('import_list')}">数据导入列表</a></li>
			</if>
		</ul>
		<div class="table-actions">
			<a href="" id="upfile" class="btn btn-sm btn-default">选择文件</a>
		</div>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<!-- <th width="50">ID</th> -->
					<th>文件名</th>
					<th>创建时间</th>
					<th>状态</th>
					<th>上传人</th>
					<th>消息</th>
					<th>成功数量</th>
					<th>失败数量</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="lists" item="vo">
				<tr>
					<!-- <td>{$vo.id}</td> -->
					<td>{$vo.filename}</td>
					<td>{$vo.create_time|date="Y-m-d",###}</td>
					<td>
						<switch name="vo.status">
							<case value="0">未导入</case>
							<case value="1">导入中</case>
							<case value="2">导入完成</case>
							<case value="3">导入失败</case>
						</switch>
					</td>
					<td>{$vo.user_nickname}</td>
					<td>{$vo.message}</td>
					<td>{$vo.success_count}</td>
					<td>{$vo.error_count}</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}<li><a>共计 {$lists->total()} 条</a></li></div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script>
		$(function(){
            Wind.css('layer');
            Wind.use('layer');
            $('#upfile').click(function(){
                openUploadDialog('附件上传', function (dialog, files) {
                    $.ajax({
                        url:'{:cmf_url("upfile")}',
                        data:{file_name:files[0].filepath},
                        type:'post',
                        dataType:'json',
                        success:function(result){
                            if(result.code === 1) {
                                layer.alert(result.msg,{
                                    title:'提示',
                                    icon: 1
                                },function(){
                                    window.location.href = result.url;
                                });
                            }else{
                                layer.alert(result.msg,{
                                    title:'提示',
                                    icon: 2
                                });
                            }
                        }
                    });
                }, '', 0, 'file');
				return false;
			})
		})
	</script>
</body>
</html>